package com.lyk.coursearrange.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyk.coursearrange.dao.PostDao;
import com.lyk.coursearrange.entity.Post;
import com.lyk.coursearrange.entity.dto.PostDto;
import com.lyk.coursearrange.service.PostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PostServiceImpl extends ServiceImpl<PostDao, Post> implements PostService {

    @Autowired
    private  PostDao postDao;
    @Override
    public List<PostDto> postlist(Long user_id,String po_name) {
        if(user_id!=0) {
            return postDao.findByUserId(user_id);
        }else if(user_id==0&&po_name==null) {
            return postDao.selectallpost();
        }else {
            return postDao.postlist(po_name);
        }
    }
}
